﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace lcs.Web.protocolinfo
{
    public partial class Add : lcs.Web.Admin.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {                
                Page.DataBind();
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";            
            if (this.txtmbm.Text.Trim().Length == 0)
            {
                strErr += "中标物料不能为空！\\n";
            }            
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int sid = 0;
            if (hfsid.Value != "") sid = int.Parse(hfsid.Value);
            string mbm = hfmbm.Value;
            decimal mprice = decimal.Parse(this.txtmprice.Text);
            string pmark1 = "";
            string pmark2 = "";
            if (sid == 0) {
                Maticsoft.Common.MessageBox.Show(this, "供应商不能为空！");
                return;
            }
            if (mbm == "")
            {
                Maticsoft.Common.MessageBox.Show(this, "物料不能为空！");
                return;
            }
            lcs.Model.protocolinfo model = new lcs.Model.protocolinfo();
            model.sid = sid;
            model.mbm = mbm;
            model.mprice = mprice;
            model.pmark1 = pmark1;
            model.pmark2 = pmark2;
            lcs.BLL.protocolinfo bll = new lcs.BLL.protocolinfo();
            bll.Add(model);
            Maticsoft.Common.MessageBox.Show(this, "保存成功！请继续增加！");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("List.aspx");
        }
    }
}
